import React from 'react';
import { Modal, Select,} from 'antd';
import { Input } from 'antd';
import { connect } from 'react-redux'
import {editUser} from '../../redux/company/company'
const Option = Select.Option;
@connect(
    state => state,
    { editUser}
)
export default class EditUesrModel extends React.Component {
    constructor(){
        super();
        this.state ={
            value:""
        }
    }
    handleChange(value){
        this.setState({
            value:value
        })
    }
    handleOk(){
        let account = document.getElementById('account').value
        let phoneNum = document.getElementById('phoneNum').value
        this.props.editUser(this.props.userId,account,phoneNum,this.state.value)
    }
    render() {
        let roleList =this.props.company.qxData
        return (
            <Modal
              title="修改权限"
              visible={this.props.visible} 
              onOk={this.handleOk.bind(this)}
              wrapClassName="submiss"
              onCancel={()=>this.props.showModel()}
            >
             <div style={{width:'100%',margin:'0 auto',textAlign:'center'}}>
               <div style={{paddingBottom:20}}>用户名: <Input id='account' placeholder="必填" style={{width:200}}/></div>
               <div style={{paddingBottom:20}}>手机: <Input id='phoneNum' placeholder="必填" style={{width:200}}/></div>
               <Select  style={{ width: 200 }} onChange={this.handleChange.bind(this)}>
               {
                   !roleList ?'' :
                   roleList.map((item,index)=>
                   <Option value={item.roleId}>{item.roleName}</Option>
                   )
           
               }
                </Select>
             </div>
            </Modal>
        );
    }
}